﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Documents.web
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Categories", // Route name
                "Home/Categories/{parentCategory}", // URL with parameters
                new { controller = "Home", action = "Categories", parentCategory = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "Documents", // Route name
                "Home/Documents/{documentType}", // URL with parameters
                new { controller = "Home", action = "Documents", documentType = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "CareEvent", // Route name
                "Home/CareEvent/{careEventID}", // URL with parameters
                new { controller = "Home", action = "CareEvent" } // Parameter defaults
            );

            routes.MapRoute(
                "Patients", // Route name
                "Home/Patients/{wardCode}", // URL with parameters
                new { controller = "Home", action = "Patients" } // Parameter defaults
            );
            
            routes.MapRoute(
                "Document", // Route name
                "Home/Document/{documentID}", // URL with parameters
                new { controller = "Home", action = "Document"} // Parameter defaults
            );
            routes.MapRoute(
                "Revoke", // Route name
                "Home/Revoke/{documentID}", // URL with parameters
                new { controller = "Home", action = "Revoke" } // Parameter defaults
            );

            routes.MapRoute(
                "History", // Route name
                "Home/History/{DocumentSetID}", // URL with parameters
                new { controller = "Home", action = "History" } // Parameter defaults
            );
            routes.MapRoute(
                "Edit", // Route name
                "Home/Edit/{DocumentID}", // URL with parameters
                new { controller = "Home", action = "Edit"} // Parameter defaults
            );

            routes.MapRoute(
                "Store", // Route name
                "Home/Store", // URL with parameters
                new { controller = "Home", action = "Store" } // Parameter defaults
            );

            routes.MapRoute(
                "DocumentFilterDemo", // Route name
                "Home/DocumentFilterDemo", // URL with parameters
                new { controller = "Home", action = "DocumentFilterDemo" } // Parameter defaults
            );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Dashboard", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}